// compile this file when run:
  // `sis-manager compile`
// or
  // `sis-manager install`

# include "sis.hpp"

// move to sis lib
# include <string>
# include <vector>

// typedef std::string str;
// using std::vector;
typedef std::vector<str> strs;
// typedef std::vector<Keys> Keyses;

struct key
{
  str _key; // -
  // str _full_key; // --
  str _value;
};

class keys
{
  private:
    std::vector<key> my_keys;


  public:
    keys (int keyc, str _key, ...)
    {
      this->my_keys = std::vector<key> ();
      // for _key in _keys:
        // my_keys +=  key (_key, "")
    }
    
    keys ()
    {
      this->my_keys = std::vector<key> ();
    }
    
    
    bool
    find (str _key)
    {
      for (auto i _in this->my_keys)
        if (i._key == _key) return true;
      return false;
    }
    
    
    int
    search (str _key)
    {
      int result= -1;
      for (auto i : this->my_keys)
        {
            if (i._key == _key) break;
            result++;
        }
      return result;
    }
    
    /*
     * if _key not found, then return answer=""
     * */
    str
    get (str _key, str default_answer="")
    {
      str answer = default_answer;
      if (this->find (_key))
        answer=this->my_keys[this->search (_key)]._value;
      return answer;
    }
    
    
    void
    operator+= (key new_key)
    {
      this->my_keys.push_back (new_key);
    }
};

strs
get_args (int my_argc, char** my_args)
{
  // pass:
  return std::vector<str> ();
}

strs
get_argv (strs args, keys _keys)
{
  // pass:
  return std::vector<str> ();
}

keys
get_keys (strs args, keys _keys)
{
  // pass:
  return keys ();
}



int main (int argc, char **args)
{
  // if using args_keys and Keys then: args (all params), argv (only params), keys (only keys params, where keys from params for Keys)

  keys my_keys (3, "u", "d", "r"); // all -udr keys from args to keys

  // parting argumnets to only_args, args_all and args_keys:
  strs
    args_all = get_args (argc, args), // all args
    only_args = get_argv (args_all, my_keys); // all args without options (keys) "- --"
  keys args_keys = get_keys (args_all, my_keys);  // only options (keys) "- --"

  str
    domen = args_keys.get ("d", "notabug.org"), // or github.com
    user = args_keys.get ("u", "sis"), // (not anon_1) or Anonymous_1
    repo = args_keys.get ("r", only_args[1]); // or sis-src or sis-doc or sis-conf

  __run ("git clone https://" + domen + "/" + user + "/" + repo);
}
